import shaw.wifi.encryption.AesEncryption;
import shaw.wifi.encryption.RsaEncryption;
import junit.framework.TestCase;


public class TestEncryption extends TestCase {
	private RsaEncryption rsaEncrypt = new RsaEncryption();
	private AesEncryption aesEncrypt = new AesEncryption();
	
	public TestEncryption() {
		super();
		
		rsaEncrypt.generateKeys();
		
		aesEncrypt.setIvParameterSpec("abcdabcdabcdabcd".getBytes());
		aesEncrypt.setSharedSecret("qwertyuiqwertyui".getBytes());
	}
	
	public void testRsaEncrypt() {
		byte[] crypt = rsaEncrypt.encryptRsa("zxcvbnm".getBytes());
		byte[] plain = rsaEncrypt.decryptRsa(crypt);
		
		assertEquals(new String(plain), "zxcvbnm");
	}
	
	public void testAesEncrypt() {
		byte[] crypt = aesEncrypt.encryptAes("zxcvbnm".getBytes());
		byte[] plain = aesEncrypt.decryptAes(crypt);
		
		assertEquals(new String(plain), "zxcvbnm");
	}
}
